
#include "stdio.h"
#include "signal.h"
#include <sys/stat.h>
int main()
{
    int rv=0;
    int new_sig=0;
   
    sigset_t set;
    sigemptyset(&set);
    sigaddset(&set, SIGINT);
    sigaddset(&set, SIGQUIT);

    rv = sigprocmask(SIG_BLOCK, &set, NULL);
    if (rv == -1) {
        perror("sigprocmask error");
        return 1;
    }
    while (1) {
        rv = sigwait(&set, &new_sig);
        if (rv == -1) {
            perror("sigwait error");
            return 1;
        }else{
            switch (new_sig){
                case SIGINT:
                    printf("sigwait SIGINT\n");
                    break;
                case SIGQUIT:
                    printf("sigwait SIGQUIT\n");
                    return 0;
                    break;
                default:
                    printf("sigwait unknown signal\n");
                    break;
            }
        }
    }
    return 0;
}